*Pollution abatement cost expenditure (PACE) data*
clear all

*Raw PACE costs for SIC sectors*
import excel PACEfourdigit_realstock.xlsx,sheet("Blad1") first

*We map SIC codes to NACE codes*
merge 1:m sic1987 using "SIC_NACE_correspondence.dta"

keep if _merge==3

drop _merge

bysort sni2007_4d: egen real_capstock=total(real_capital_stock)

duplicates drop sni2007_4d, force


tostring sni2007_4d, replace

replace sni2007_4d="0230" if sni2007_4d=="230"
replace sni2007_4d="0812" if sni2007_4d=="812"

keep sni2007_4d real_capstock

save PACE_realcapstock_2.dta, replace

***cost energy***

clear all


import excel PACE_four_digit20201005.xlsx,sheet("Blad1") first

merge 1:m sic1987 using "SIC_NACE_correspondence.dta"

keep if _merge==3

drop _merge

bysort sni2007_4d: egen sum_cost_material=total(cost_materials)
bysort sni2007_4d: egen sum_cost_wages=total(cost_prodworkwages)
bysort sni2007_4d: egen sum_cost_energy=total(cost_energy)


duplicates drop sni2007_4d, force


tostring sni2007_4d, replace

replace sni2007_4d="0230" if sni2007_4d=="230"
replace sni2007_4d="0812" if sni2007_4d=="812"

keep sni2007_4d sum_cost_material sum_cost_wages sum_cost_energy

save PACE_costs.dta, replace